package com.test.chatdemo.mapper;

import com.test.chatdemo.pojo.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Insert("insert into user (name, password) " +
            "values (#{name},#{password})")
    void register(User user);


    @Select("select * from user where name = #{name} and password = #{password}")
    User getUser(User user);

    @Select("select name from user where name = #{name}")
    User getUserName(String name);

    @Update("update user set password = #{newPassword} where name = #{name} and password = #{password}")
    void changePassword(NewUser newUser);

}
